<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>球员添加</title>
		<script type="text/javascript" src="/js/jquery-1.11.1.js"></script>
		<script type="text/javascript" src="/js/bootstrap.js"></script>
		<link rel="stylesheet" type="text/css" href="/css/bootstrap.css"></link>
		<link rel="stylesheet" type="text/css" href="/css/style.css"></link>
		<style>
			label span{color: #ff0000; padding-right: 5px;}
		</style>
	</head>

	<body>
		<h2>添加球员</h2>
		<form id="myForm" class="form-horizontal" method="post" action="/team">
			<div class="form-group">
				<label class="col-sm-1 control-label"><span>*</span>所属球队</label>
				<div class="col-sm-2">
					<select name="teamId" class="form-control">
						<option value="-1">请选择主场球队</option>
						<option value="1001">76人</option>
						<option value="1002">篮网</option>
						<option value="1003">雄鹿</option>
						<option value="1004">黄蜂</option>
						<option value="1005">老鹰</option>
						<option value="1006">热火</option>
						<option value="1007">凯尔特人</option>
						<option value="1008">尼克斯</option>
						<option value="1009">步行者</option>
						<option value="1010">公牛</option>
						<option value="1011">猛龙</option>
						<option value="1012">骑士</option>
						<option value="1013">奇才</option>
						<option value="1014">魔术</option>
						<option value="1015">活塞</option>
						<option value="1016">爵士</option>
						<option value="1017">太阳</option>
						<option value="1018">快船</option>
						<option value="1019">掘金</option>
						<option value="1020">湖人</option>
						<option value="1021">开拓者</option>
						<option value="1022">独行侠</option>
						<option value="1023">灰熊</option>
						<option value="1024">马刺</option>
						<option value="1025">勇士</option>
						<option value="1026">鹈鹕</option>
						<option value="1027">国王</option>
						<option value="1028">雷霆</option>
						<option value="1029">火箭</option>
						<option value="1030">森林狼</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label"><span>*</span>球员名字</label>
				<div class="col-sm-9">
					<input required="" name="playerName" class="form-control" placeholder="请输入球员名字"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">球员队号</label>
				<div class="col-sm-9">
					<input name="playerNum" class="form-control" placeholder="请输入球员队号"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">球员位置</label>
				<div class="col-sm-2">
					<select name="location" class="form-control">
						<option value="小前锋">小前锋</option>
						<option value="大前锋">大前锋</option>
						<option value="中锋">中锋</option>
						<option value="组织后卫">组织后卫</option>
						<option value="防守后卫">防守后卫</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">出生日期</label>
				<div class="col-sm-2">
					<input name="birthday" class="form-control" type="date"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">国籍</label>
				<div class="col-sm-9">
					<input name="nationality" class="form-control" placeholder="请输入所属国籍"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">球员身高</label>
				<div class="col-sm-9">
					<input name="height" class="form-control" placeholder="请输入球员身高"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">球员体重</label>
				<div class="col-sm-9">
					<input name="weight" class="form-control" placeholder="请输入球员体重"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">球员薪水</label>
				<div class="col-sm-9">
					<input name="salary" class="form-control" placeholder="请输入球员薪水"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label">状态</label>
				<div class="col-sm-2">
					<select name="status" class="form-control">
         				<option value="0">健康</option>
         				<option value="1">伤休</option>
			      	</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label"></label>
				<div class="col-sm-9">
					<button id="btnAdd" type="button" class="btn btn-sm btn-info">提&nbsp;交</button>
					<button type="reset"  class="btn btn-sm btn-warning">重&nbsp;置</button>
				</div>
			</div>
		</form>		
	</body>
</html>
<script>
	$(function () {
		//提交按钮的单击事件
		$("#btnAdd").click(function () {
			$.ajax({
				type: "POST",
				url: "/player/",
				data: $("#myForm").serialize(),
				dataType:"json",
				success: function(vo){
					if(vo.code==200) {
						window.location.href = "/pages/player/list.html";
					}else{
						alert("添加失败！"+vo.msg);
					}
				}
			});
		});
	});
</script>